let smallest l = 
  let l = List.filter (fun i -> i > 0) l in
  match l with
    [] -> raise (Invalid_argument "smallest")
  | h::tl -> 
      List.fold_left (fun m i -> if i < m then i else m) h tl

exception E3

let rec helper acc i = 
  if acc * acc > i then acc - 1
  else helper (acc + 1) i

let e3 i = 
  if i < 0 then raise E3
  else helper 0 i